<?php
	session_start();
	
	if (isset($_SESSION['tmsUserID']) == FALSE)
	{
		if(($_POST['userid']) && ($_POST['password'])) //This will only be called on main.php
		{
			//Log in code to check password
			$_SESSION['tmsUserID'] = "1001";
			
		}else{ //This will only be called on main.php
			include "login.php";
			exit();
		}
		
		// ALL OTHER PAGES USE THIS:
		//$_SESSION['errorMessage'] = "You are not logged on.<br>Click <a href=\"main.php\">here</a> to log in";
		//include "error.php";
		//exit();
	}
	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

  <head>
    <title>Payroll and Timesheet Management Website</title>
    <link rel="stylesheet" type="text/css" href="styles.css"/>
	<script type="text/javascript" src="clock.js"></script>
  </head>
  <body onload="javascript:servertime(<?php $time = date("H") . "," . date("i"). "," . date("s"); echo $time; ?>);">
  
	<?php include("header.php"); ?>
	
	<p></p>
	<div class="center">
	<!-- Clock div -->
	<div class="clock" id="clock"></div>
	
	<!-- These are the messages for the day clock in until clock out-->
	<p class="message">
	Signed in at 8:00 AM<br/>
	<br/>
	</p>
	
	<!-- these actions will change depending on what the user can do (they can't clock in twice) -->
	<div class="actions">
	<form action="main.php" method="POST">
	<p>
		<input type="hidden" name="tmsEvent" value="3" />
		<input type="submit" value="To Lunch" class="button"/>
	</p>
	</form>
	<form action="main.php" method="POST">
	<p>
		<input type="hidden" name="tmsEvent" value="2" />
		<input type="submit" value="Clock Out" class="button"/>
	</p>
	</form>
	</div>
	</div>
  </body>
</html>